home *** CD-ROM | disk | FTP | other *** search
/ Computer Life: SuperPac / SuperPac (Computer Life Magazine)(Ziff-Davis)(1995).ISO / pc / demos / nile / senet.exe / senet.DXR / 00029.ls < prev    next >
Encoding:
Text File  |  1995-05-04  |  2.0 KB  |  42 lines

  1. on optimizeHardWireCastNum
  2.   repeat with x = 1 to 1000
  3.     if the castType of cast x = #script then
  4.       set castScriptText to the scriptText of cast x
  5.       set prevCastScriptText to EMPTY
  6.       repeat while offset("the number of cast", castScriptText)
  7.         set startOffset to offset("the number of cast", castScriptText)
  8.         set firstQuoteFlag to 0
  9.         set endOffset to startOffset + 18
  10.         if (char endOffset of castScriptText = QUOTE) or (char endOffset + 1 of castScriptText = QUOTE) then
  11.           repeat while (char endOffset of castScriptText <> QUOTE) or not firstQuoteFlag
  12.             if char endOffset of castScriptText = RETURN then
  13.               exit repeat
  14.             end if
  15.             if char endOffset of castScriptText = QUOTE then
  16.               set firstQuoteFlag to 1
  17.             end if
  18.             set endOffset to endOffset + 1
  19.           end repeat
  20.           if char endOffset of castScriptText = RETURN then
  21.             debug("ERROR: " & char startOffset to endOffset of castScriptText & ": Encountered RETURN b4 close quote")
  22.             debug("NOT REPLACED!!")
  23.             set prevCastScriptText to prevCastScriptText & char 1 to endOffset of castScriptText
  24.             delete char 1 to endOffset of castScriptText
  25.           else
  26.             set castNumber to 0
  27.             do("set castNumber = " & char startOffset to endOffset of castScriptText)
  28.             debug("Replacing " & char startOffset to endOffset of castScriptText & " with " & castNumber)
  29.             put castNumber into char startOffset to endOffset of castScriptText
  30.           end if
  31.           next repeat
  32.         end if
  33.         debug("ERROR: " & char startOffset to endOffset + 1 of castScriptText & ": No legal opening quote encountered")
  34.         debug("NOT REPLACED!!")
  35.         set prevCastScriptText to prevCastScriptText & char 1 to endOffset of castScriptText
  36.         delete char 1 to endOffset of castScriptText
  37.       end repeat
  38.       set the scriptText of cast x to prevCastScriptText & castScriptText
  39.     end if
  40.   end repeat
  41. end
  42.